package cn.wolfcode.crm.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Getter
@Setter
public class Customer extends BaseDomain {

    private String name;

    private Integer age;

    private Integer gender;

    private String tel;

    private String qq;

    private SystemdictionaryItem job;//需要注意的地方
    private SystemdictionaryItem source;//需要注意的地方

    private Employee seller;

    private Employee inputUser;

    private Date inputTime;



    public static final Integer STATUS_POTENTIAL = 0;//潜在客户
    public static final Integer STATUS_POOLED = 1;//客户池
    public static final Integer STATUS_NORMAL = 2;//正式客户
    public static final Integer STATUS_FAILED = 3; //失败客户
    public static final Integer STATUS_LOSSED = 4;//流失客户
    private Integer status = STATUS_POTENTIAL;//把常量赋值给status代表状态
    public String getJson() {

        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("age",age);
        map.put("gender",gender);
        map.put("tel",tel);
        map.put("qq",qq);


        map.put("jobId",job.getId());//为什么这么存储
        map.put("sourceId",source.getId());
        map.put("sellerId",seller.getId());
        map.put("sellerName",seller.getName());
        //为什么没有封装??这两个
        /*map.put("inputUser",inputUser);
        map.put("inputTime",inputTime);*/

        return JSON.toJSONString(map);
    }


}